package net.suncaper.psychological.service.impl;

import net.suncaper.psychological.mapper.AppointmentMapper;
import net.suncaper.psychological.mapper.impl.AppointmentMapperImpl;
import net.suncaper.psychological.model.domain.Appointment;
import net.suncaper.psychological.service.IAppointmentService;
import java.util.List;

public class AppointmentServiceImpl implements IAppointmentService {
    private final AppointmentMapper appointmentMapper = new AppointmentMapperImpl();

    @Override
    public boolean addAppointment(Appointment appointment) {
        return appointmentMapper.insertAppointment(appointment) > 0;
    }

    @Override
    public Appointment getAppointmentByStudentId(String studentId) {
        return appointmentMapper.selectAppointmentByStudentId(studentId);
    }

    @Override
    public boolean cancelAppointment(Long appointmentId, String cancelReason) {
        return appointmentMapper.cancelAppointment(appointmentId, cancelReason);
    }

    @Override
    public List<Appointment> getHistoryAppointmentsByStudentId(String studentId) {
        return appointmentMapper.selectHistoryAppointmentsByStudentId(studentId);
    }

    @Override
    public List<Appointment> getAllAppointmentsByStudentId(String studentId) {
        return appointmentMapper.selectAllAppointmentsByStudentId(studentId);
    }

    @Override
    public boolean updateAppointmentStatus(Long appointmentId, String status) {
        return appointmentMapper.updateAppointmentStatus(appointmentId, status);
    }

    @Override
    public boolean updateAppointmentArrangement(Long appointmentId, String scheduledTime, String scheduledPlace) {
        return appointmentMapper.updateAppointmentArrangement(appointmentId, scheduledTime, scheduledPlace) > 0;
    }

    @Override
    public List<Appointment> getApprovedInitialAppointments() {
        return appointmentMapper.selectApprovedInitialAppointments();
    }
} 